﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using SalePoints.WcfServices;
namespace SalePoints.Models
{
	public class LogServices
	{
		/// <summary>
		/// Add Log
		/// </summary>
		/// <param name="ex"></param>
		/// <param name="onLogged"></param>
		public static void AddLog(Exception ex,Action onLogged) {
			WcfServices.SalePointServicesClient proxy = new SalePoints.WcfServices.SalePointServicesClient();
			proxy.LogCompleted += (s, e) => {
				if (null != onLogged) {
					onLogged();
				}
				proxy.CloseAsync();
			};
			proxy.LogAsync(new BOMessager { 
				Body=ex.StackTrace,
				IsError=true
			});
		}
	}
}
